import '@/assets/css/index.less';
import arrowdown from '@/assets/images/arrowdown.png';
import arrowup from '@/assets/images/arrowup.png';
import edit from '@/assets/images/edit.png';
import layoutgrid from '@/assets/images/layoutgrid.png';
import preview from '@/assets/images/preview.png';
import jh from '@/assets/images/jh.png';
import copy from '@/assets/images/copy.png';
import gl from '@/assets/images/gl.png';
import notes from '@/assets/images/notes.png';
import rubberstamp from '@/assets/images/rubberstamp.png';
import server from '@/assets/images/server.png';
import trash from '@/assets/images/trash.png';
import TreeSide from '@/components/TreeSide';
import { getCategoryList } from '@/services/category';
import { createUser } from '@/services/groupNumber';
import {getTopicInfoList, topicApprove, topicChange, topicDelete, topicSelectOne} from '@/services/topic';
import {DeleteOutlined, PlusOutlined, SearchOutlined} from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import { history, useLocation, useModel } from 'umi';
import {
  Button,
  Col,
  DatePicker,
  Form,
  Input,
  message,
  Modal, Popconfirm,
  Radio,
  Row,
  Select,
  Table,
} from 'antd';
import {LocalFormat} from '@/utils/localHelper';
import locale from 'antd/es/date-picker/locale/zh_CN';

// import 'dayjs/locale/zh-cn';
import 'moment/locale/zh-cn'
import moment from 'moment';
import React, { useEffect, useRef, useState } from 'react';
import './index.less';
import ArticlePreview from "@/components/articlePreview";
import C from 'crypto-js';
import Base64 from 'crypto-js/enc-base64';
import Utf8 from 'crypto-js/enc-utf8';
import {ProFormCheckbox} from "@ant-design/pro-components";
import {HOMEPAGE_URL} from "../../../../proxyConfig";
const { RangePicker } = DatePicker;

const TableList: React.FC = (props) => {
  const { initialState } = useModel('@@initialState');
  const { currentUser } = initialState || {};
  const location = useLocation();
  const [isShow, setIsShow] = useState<boolean>(false);

  const [isLoading, setIsLoading] = useState<boolean>(false);

  const actionRef = useRef<ActionType>();
  const [currentRow, setCurrentRow] = useState<any>();
  const [selectedRows, setSelectedRows] = useState<any>();
  const [shyy, setShyy] = useState<string>('');
  //用户审核弹框
  const [userAuditsOpen, setUserAuditsOpen] = useState<boolean>(false);
  //部门下拉框
  const [groupOptions, setGroupOptions] = useState([]);
  //默认下拉部门
  const [groupId, setGroupId] = useState<number>(location.state?.groupId);
  //查询list
  const [dataList, setDataList] = useState([]);
  //tree
  const [treeData, setTreeData] = useState([]);
  //ztTreeData
  const [ztTreeData, setZtTreeData] = useState([]);

  //总数
  const [total, setTotal] = useState(40);
  //page
  const [page, setPage] = useState(1);
  //pageSize
  const [pageSize, setPageSize] = useState(10);
  //分页
  const [pagination, setPagination] = useState({
    current: page,
    pageSize: pageSize,
    position: ['bottomRight'],
    size: 'small',
    showSizeChanger: true,
    total: total,
  });
  /*管理员权限id 如果当前用户拥有管理员权限则不做校验判断当前文章是否为自己发布的文章*/
  const adminRoleIds = [1,3,5]
  //select
  const [selectedTreeData, setSelectedTreeData] = useState([]);
  const [lbxz, setLbxz] = useState([]);
  const [isWzShow, setIsWzShow] = useState<boolean>(false);
  const [myEditorHtml, setMyEditorHtml] = useState('');
  const [myTitle, setMyTitle] = useState('');
  const [articleTime, setArticleTime] = useState('');

  //主题options
  const themeOptions = [
    {
      value: '',
      label: '全部主题',
    },
    {
      value: '0',
      label: '一天内的主题',
    },
    {
      value: '1',
      label: '一周内的主题',
    },
    {
      value: '2',
      label: '一月内的主题',
    },
    {
      value: '3',
      label: '一年内的主题',
    },
    {
      value: '4',
      label: '两年内的主题',
    },
  ];

  //状态options
  const ztOptions = [
    { value: 'yfb', label: '已发布' },
    { value: 'dfb', label: '待发布' },
    { value: 'shbtg', label: '审核不通过' },
    { value: 'dsh', label: '待审核' },
  ];
  //排序options
  const pxhOptions = [
    { value: '0', label: '创建时间升序' },
    { value: '1', label: '创建时间倒序' },
  ];
  /**
   * @en-US Add node
   * @zh-CN 添加节点
   * @param fields
   */
  const handleAdd = async (fields: API.UserListItem) => {
    try {
      await createUser({ ...fields });
      message.success('添加成功！');
      return true;
    } catch (error) {
      message.error('添加失败！');
      return false;
    }
  };

  /**
   *  Delete node
   * @zh-CN 删除节点
   *
   * @param row
   */
  const handleRemove = async (row: any) => {
    if (!row) return true;
    if(!adminRoleIds.includes(currentUser.roleId)){
      if(row.createBy!=currentUser.name) {
        message.error('当前用户无权限操作！')
        return;
      }
    }

    try {
      const res = await topicDelete({
        id: row.id,
      });
      if (res.code == '0') {
        message.success('已删除！');
        queryData();
      }

      return true;
    } catch (error) {
      message.error('删除失败！');
      return false;
    }
  };

  const copyTextToClipboard = (text)=> {
    if (navigator.clipboard) {
      // 现代浏览器使用异步Clipboard API
      navigator.clipboard.writeText(text).then(function() {
        message.success('复制成功');
      }).catch(function(error) {
        message.error('复制失败:'+ error);
      });
    } else {
      // IE8 使用document.execCommand()方法
      var textArea = document.createElement('textarea');
      textArea.value = text;
      document.body.appendChild(textArea);
      textArea.select(); // 选中文本

      try {
        var successful = document.execCommand('copy');
        if (successful) {
          message.success('复制成功');
        } else {
          message.success('复制失败');
        }
      } catch (err) {
        message.error('复制失败:'+err);
      }

      document.body.removeChild(textArea); // 移除临时创建的textarea
    }
  };


  //更改树结构
  const changeTreeData = (data) => {
    for (let i = 0; i < data.length; i++) {
      const element = data[i];
      element.key = element.id;
      element.title = element.name;
      if (element.children && element.children.length > 0) {
        changeTreeData(element.children);
      }
    }
    return data;
  };
  //查询分类
  const getCategory = () => {
    const params = {
      type: 'topic',
      roleId: currentUser?.roleId,
      filterType:'all'
    };
    //获取组list
    getCategoryList(params).then(async (res) => {
      const data = changeTreeData(res.data);
      data.forEach((element) => {
        if (element.title == '专题') {
          setZtTreeData([element]);
        }
      });
      setTreeData(data);
    });
  };

  useEffect(() => {
    getCategory();
  }, []);

  useEffect(() => {
    queryData();
  }, [page, pageSize, selectedTreeData]);

  const jumpPublish = (record: any) => {
    history.push({
      pathname: '/consultCenter/publishArticle',
      state: {
        formValues: record,
      },
    });
  };
  const rowChange = async (record: any, type: string) => {
    let params = {
      id: record.id,
    };
    switch (type) {
      case '5':
        params.sfgl = 1;
        break;
      case '6':
        params.shJh = 1;
        break;
      case '7':
        params.type = 1;
        break;
      case '8':
        params.type = 0;
        break;
      default:
        break;
    }
    const res = await topicChange(params);
    if (res.code == '0') {
      message.success('修改成功！');
      queryData();
    }
  };
  const columns: ProColumns<any>[] = [
    {
      title: '分类',
      align: 'center',
      dataIndex: 'classifyName',
    },

    {
      title: '标题',
      align: 'center',
      dataIndex: 'title',
    },
    {
      title: '发布者',
      align: 'center',
      width: 120,
      dataIndex: 'fbrmc',
    },
    {
      title: '部门',
      dataIndex: 'fbbmmc',
      align: 'center',
    },
    {
      title: '创建时间',
      align: 'center',
      dataIndex: 'createTime',
      valueType: 'dateTime',
    },
    {
      title: '状态',
      align: 'center',
      width: 120,
      dataIndex: 'zt',
    },
    {
      title: '发布时间',
      align: 'center',
      dataIndex: 'publishtime',
      valueType: 'dateTime',
    },
    {
      title: '排序',
      align: 'center',
      width: 90,
      dataIndex: 'pxh',
    },
    {
      title: '浏览量',
      align: 'center',
      width: 90,
      dataIndex: 'visitnum',
    },
    {
      title: '操作',
      align: 'center',
      dataIndex: 'option',
      fixed: 'right',
      render: (_, record) => {
        return(<Row>
            {(record.buttonVisVo.canEdit?
                <Col span={6} >
                  <img title="编辑" src={edit} key={1} onClick={() => jumpPublish(record)} />
                </Col> : null)}
            {(record.buttonVisVo.canDelete?
              <Col span={6} >
                <Popconfirm title="确定是否删除?" onConfirm={() => handleRemove(record)} key="delete">
                    <img title="删除" src={trash} key={2} />
                </Popconfirm>,

              </Col> : null)}
            {(record.buttonVisVo.canSetOrder?
              <Col span={6} >
                <img
                  src={server}
                  title="排序"
                  key={3}
                  onClick={() => {
                    setCurrentRow(record);
                    setIsOrder(true);
                  }}
                />
              </Col> : null)}
            {(record.buttonVisVo.canApprove?
              <Col span={6} >
                <img
                  src={rubberstamp}
                  title="审核"
                  key={4}
                  onClick={() => {
                    setCurrentRow(record);
                    setIsSh(true);
                  }}
                />
              </Col> : null)}
            {(record.buttonVisVo.canSetSubject?
              <Col span={6} >
                <img
                  src={notes}
                  title="设置专题"
                  key={5}
                  onClick={() => {
                    setIsZt(true);
                    setCurrentRow(record);
                    setIsShow(true);
                  }}
                />

              </Col> : null)}
            {(record.buttonVisVo.canMoveUp?
              <Col span={6} >
                <img title="上移" src={arrowup} key={9} onClick={() => rowChange(record, '7')} />

              </Col> : null)}

            {(record.buttonVisVo.canMoveDown?
              <Col span={6} >
                <img
                  title="下移"
                  src={arrowdown}
                  key={10}
                  onClick={() => rowChange(record, '8')}
                />
              </Col> : null)}
            {(record.buttonVisVo.canSetCat?
              <Col span={6} >
                <img
                  title="设置分类"
                  src={layoutgrid}
                  key={11}
                  onClick={() => {
                    setIsZt(false);
                    setCurrentRow(record);
                    setIsShow(true);
                  }}
                />
              </Col> : null)}
            {(record.buttonVisVo.canPreview?
              <Col span={6} >
                <img
                  title="预览"
                  src={preview}
                  key={11}
                  onClick={()=>{
                    const url = HOMEPAGE_URL+'pages/article/preview.html?id='+record.id+'&type=preview'
                    window.open(url)
                  }}
                />

              </Col> : null)}
            {
              record.buttonVisVo.canJh ?
                <Col span={6} >
                <img
                  title="精华"
                  src={jh}
                  style={{width:'23px',height:'23px'}}
                  key={12}
                  onClick={() => rowChange(record, '6')}
                />

              </Col> : null
            }
            {
              record.buttonVisVo.canHighLight ? <Col span={6} >
                <img
                  title="高亮"
                  src={gl}
                  style={{width:'20px',height:'20px'}}
                  key={13}
                  onClick={() => rowChange(record, '5')}

                />

              </Col> : null
            }
            <Col span={6} >
              <img
                title="复制链接"
                src={copy}
                style={{width:'20px',height:'20px'}}
                key={12}
                onClick={() => {
                  console.log(record);
                  if(record.zt!='已发布'){
                    message.error('该文章状态为:'+record.zt);
                    return
                  }
                  let url = HOMEPAGE_URL
                  /*部署特勤局时需要修改内容*/
                  if(record.classify == 'a8779dd7-5b2e-4517-9286-5fa2bd3d1040'){
                    url+='pages/monthStar/index.html?id='+record.id+'&name='+record.name
                  }else{
                    url+='pages/morePage/index.html?id='+record.id+'&name='+record.name
                  }
                  copyTextToClipboard(url)
                }}
              />

            </Col>
            {/* <Col span={6}>
                  <a key={6} onClick={() => rowChange(record, '4')}>
                    推
                  </a>
                </Col>
                <Col span={6}>
                  <a key={7} onClick={() => rowChange(record, '5')}>
                    高
                  </a>
                </Col>
                <Col span={6}>
                  <a key={8} onClick={() => rowChange(record, '6')}>
                    精
                  </a>
                </Col> */}

        </Row>
        )

/*        if (currentUser?.roleId) {
          if (currentUser?.roleId == 2 || currentUser?.roleId == 4) {
            return (
              <Row>
                <Col offset={2} span={6}>
                  <img title="编辑" src={edit} key={1} onClick={() => {
                    if(!adminRoleIds.includes(currentUser.roleId)) {
                      if (record.createBy != currentUser.name) {
                        message.error('当前用户无权限操作！')
                        return;
                      }
                    }
                    jumpPublish(record)
                  }} />
                  {/!* <a key={1} onClick={() => jumpPublish(record)}>
                  编
                </a> *!/}
                </Col>
                <Col span={6}>
                  <img title="删除" src={trash} key={2} onClick={() => handleRemove(record)} />
                  {/!* <a key={2} onClick={() => handleRemove(record)}>
                  删
                </a> *!/}
                </Col>
              </Row>
            );
          } else {
            return (
              <Row>
                <Col span={6}>
                  <img title="编辑" src={edit} key={1} onClick={() => jumpPublish(record)} />
                  {/!* <a key={1} onClick={() => jumpPublish(record)}>
                    编
                  </a> *!/}
                </Col>
                <Col span={6}>
                  <img title="删除" src={trash} key={2} onClick={() => handleRemove(record)} />
                  {/!* <a key={2} onClick={() => handleRemove(record)}>
                    删
                  </a> *!/}
                </Col>
                <Col span={6}>
                  <img
                    src={server}
                    title="排序"
                    key={3}
                    onClick={() => {
                      setCurrentRow(record);
                      setIsOrder(true);
                    }}
                  />
                  {/!* <a
                    key={3}
                    onClick={() => {
                      setCurrentRow(record);
                      setIsOrder(true);
                    }}
                  >
                    排
                  </a> *!/}
                </Col>
                <Col span={6}>
                  <img
                    src={rubberstamp}
                    title="审核"
                    key={4}
                    onClick={() => {
                      setCurrentRow(record);
                      setIsSh(true);
                    }}
                  />

                  {/!* <a
                    key={4}
                    onClick={() => {
                      setCurrentRow(record);
                      setIsSh(true);
                    }}
                  >
                    审
                  </a> *!/}
                </Col>

                <Col span={6}>
                  <img
                    src={notes}
                    title="设置专题"
                    key={5}
                    onClick={() => {
                      setIsZt(true);
                      setCurrentRow(record);
                      setIsShow(true);
                    }}
                  />

                  {/!* <a
                    key={5}
                    onClick={() => {
                      setIsZt(true);
                      setCurrentRow(record);
                      setIsShow(true);
                    }}
                  >
                    专
                  </a> *!/}
                </Col>
                {/!* <Col span={6}>
                  <a key={6} onClick={() => rowChange(record, '4')}>
                    推
                  </a>
                </Col>
                <Col span={6}>
                  <a key={7} onClick={() => rowChange(record, '5')}>
                    高
                  </a>
                </Col>
                <Col span={6}>
                  <a key={8} onClick={() => rowChange(record, '6')}>
                    精
                  </a>
                </Col> *!/}

                <Col span={6}>
                  <img title="上移" src={arrowup} key={9} onClick={() => rowChange(record, '7')} />
                  {/!* <a key={9} onClick={() => rowChange(record, '7')}>
                    提
                  </a> *!/}
                </Col>
                <Col span={6}>
                  <img
                    title="下移"
                    src={arrowdown}
                    key={10}
                    onClick={() => rowChange(record, '8')}
                  />
                  {/!* <a key={10} onClick={() => rowChange(record, '8')}>
                    下
                  </a> *!/}
                </Col>
                <Col span={6}>
                  <img
                    title="设置分类"
                    src={layoutgrid}
                    key={11}
                    onClick={() => {
                      setIsZt(false);
                      setCurrentRow(record);
                      setIsShow(true);
                    }}
                  />

                  {/!* <a
                    key={11}
                    onClick={() => {
                      setIsZt(false);
                      setCurrentRow(record);
                      setIsShow(true);
                    }}
                  >
                    分
                  </a> *!/}
                </Col>
                <Col span={6}>
                  <img
                    title="预览"
                    src={preview}
                    key={11}
                    onClick={async () => {
                      const res = await topicSelectOne({id:record.id})
                      console.log(res);
    /!*                  const base64 = C.enc.Base64.parse(res.data.richtext);
                      const words = C.enc.Utf8.stringify(base64);*!/
                      setMyEditorHtml(res.data.richtext);
                      setMyTitle(res.data.title)
                      setIsWzShow(true)
                    }}
                  />

                  {/!* <a
                    key={11}
                    onClick={() => {
                      setIsZt(false);
                      setCurrentRow(record);
                      setIsShow(true);
                    }}
                  >
                    分
                  </a> *!/}
                </Col>
              </Row>
            );
          }
        } else {
          return;
        }*/
      },
    },
  ];

  const [form] = Form.useForm();
  //初始化搜索区域
  const _initSearchForm = () => {
    return (
      <div className="ant-pro-table-search ant-pro-table-search-query-filter">
        <Form
          form={form}
          initialValues={{
            // titleType: '0',
            // zt: 'ysh',
            creater: '0',
            // px: '1',
          }}
          className="ant-form ant-form-horizontal ant-pro-form-query-filter"
          layout="inline"
        >
          <Row style={{ width: '100%' }} gutter={[16, { xs: 8, sm: 16, md: 24, lg: 32 }]}>
            <Col span={4}>
              <Form.Item name="searchKey">
                <Input placeholder="关键字" />
              </Form.Item>
            </Col>

            <Col span={3}>
              <Form.Item name="titleType">
                <Select placeholder="请选择" options={themeOptions} allowClear />
              </Form.Item>
            </Col>

            <Col span={6}>
              <Form.Item label="发布时间" name="dataDate">
                <RangePicker locale={locale} allowEmpty={[true, true]} />
              </Form.Item>
            </Col>
            <Col span={3}>
              <Form.Item name="zt">
                <Select placeholder="请选择" allowClear options={ztOptions} />
              </Form.Item>
            </Col>
            <Col span={3}>
              <Form.Item name="creater">
                <Select
                  placeholder="请选择"
                  options={[
                    { value: '0', label: '全部主题' },
                    // { value: '2', label: '热门主题' },
                    { value: '1', label: '仅我发表的' },
                  ]}
                  allowClear
                />
              </Form.Item>
            </Col>
            <Col span={3}>
              <Form.Item name="px">
                <Select placeholder="请选择" options={pxhOptions} allowClear />
              </Form.Item>
            </Col>
            <Col span={3}>
{/*              <Form.Item name="sfjh">
                <Select placeholder="请选择" options={pxhOptions} allowClear />
              </Form.Item>*/}
              <ProFormCheckbox  name="sfjh">
                精华文章
              </ProFormCheckbox>
            </Col>
            <Col span={3}>

              <ProFormCheckbox  name="sfgl">
                高亮文章
              </ProFormCheckbox>
            </Col>
            <Col span={1} className="basic-search-form-submit-btn" style={{ display: 'flex' }}>
              <Button
                type="primary"
                htmlType="submit"
                onClick={async () => {
                  await queryData(true);
                }}
              >
                <SearchOutlined />
                查询
              </Button>
            </Col>
          </Row>
        </Form>
      </div>
    );
  };

  //查询
  const queryData = async (flag) => {
    setIsLoading(true);
    let values = form.getFieldsValue();
    //分类
    values.sfgl = values.sfgl ? 1 : 0
    values.sfjh = values.sfjh ? 1 : 0
    if (selectedTreeData.length > 0) {
      values.classify = selectedTreeData;
    }

    if (values.dataDate != null && values.dataDate != undefined) {
      values.timeStart = !!values.dataDate[0]
        ? moment(values.dataDate[0]).format('YYYY-MM-DD') + ' 00:00:00'
        : null;
      values.timeEnd = !!values.dataDate[1]
        ? moment(values.dataDate[1]).format('YYYY-MM-DD') + ' 23:59:59'
        : null;
    }

    const params = {
      page: flag ? 1 : page,
      pageSize: pageSize,
      ...values,
      roleId: currentUser?.roleId,
    };
    const msg = await getTopicInfoList(params);
    setIsLoading(false);
    setDataList(msg.data.list);
    setPagination({ current: flag ? 1 : page, pageSize: pageSize, total: msg.data.total });
  };

  const handleTableChange = (pagination: any) => {
    setPagination({ ...pagination });
    setPage(pagination.current);
    setPageSize(pagination.pageSize);
  };

  const [isOrder, setIsOrder] = useState(false);

  //order
  const [orderNum, setOrderNum] = useState(0);

  const [isSh, setIsSh] = useState(false);

  //是否是专题
  const [isZt, setIsZt] = useState(false);
  //order
  const [shNum, setShNum] = useState(0);
  //排序弹框
  const handleOrderOk = async () => {
    const params = {
      id: currentRow.id,
      pxh: orderNum,
    };
    const res = await topicChange(params);
    if (res.code == '0') {
      message.success('修改成功！');
      queryData();
    }
    setIsOrder(false);
  };

  const handleOrderCancel = () => {
    setIsOrder(false);
  };

  const onOrderChange = (e: any) => {
    setOrderNum(e.target.value);
  };

  //类别弹框
  const handleLbxzOk = async () => {
    const params = {
      id: currentRow.id,
      classify: lbxz,
    };
    const res = await topicChange(params);
    if (res.code == '0') {
      message.success('修改成功！');
      queryData();
    }
    setIsShow(false);
  };
  //审核弹框
  const handleShOk = async () => {
    let params = {
      id: currentRow.id,
      sftg: shNum,
    };
    if (shNum == 0) {
      params.sbyy = shyy;
    }
    const res = await topicApprove(params);
    if (res.code == '0') {
      queryData();
    }
    setShNum(0);
    setIsSh(false);
  };

  const handleShCancel = () => {
    setIsSh(false);
    setShNum(0);
  };

  const onShChange = (e: any) => {
    setShNum(e.target.value);
  };
  return (
    <PageContainer
      header={{
        title: false,
      }}
    >
      {_initSearchForm()}
      <div className="centerBody">
        <Row>
          <Col span={24} className="firstRow">
            <Button
              type="primary"
              key="primary"
              onClick={() => {
                history.push('/consultCenter/publishArticle');
              }}
            >
              <PlusOutlined />
              发布文章
            </Button>
          </Col>
          <Col span={4}>
            <TreeSide defaultData={treeData} setSelectedTreeData={setSelectedTreeData} />
          </Col>
          <Col span={20}>
            <Table
              loading={isLoading}
              scroll={{ x: 1350 }}
              size="small"
              actionRef={actionRef}
              rowKey="id"
              search={false}
              tableStyle={{ textAlign: 'center' }}
              options={false}
              onChange={handleTableChange}
              dataSource={dataList}
              columns={columns}
              pagination={pagination}
              rowSelection={{
                onChange: (_, selectedRows) => {
                  setShNum(0);
                  setSelectedRows(selectedRows);
                },
              }}
            />
          </Col>
        </Row>
      </div>
      <Modal
        destroyOnClose
        title="文章预览"
        open={isWzShow}
        onCancel={() => setIsWzShow(false)}
        width={780}
        onOk={() => setIsWzShow(false)}
      >
        <ArticlePreview time={articleTime} editHtml={myEditorHtml} title={myTitle} />
      </Modal>
      <Modal
        destroyOnClose
        title="排序"
        open={isOrder}
        onOk={handleOrderOk}
        onCancel={handleOrderCancel}
      >
        <Input placeholder="请输入排序!" onChange={onOrderChange} />
      </Modal>
      <Modal destroyOnClose title="审核" open={isSh} onOk={handleShOk} onCancel={handleShCancel}>
        <Radio.Group onChange={onShChange} defaultValue={0}>
          <Radio value={0}>审核不通过</Radio>
          <Radio value={1}>审核通过</Radio>
        </Radio.Group>
        {shNum === 1 ? null : (
          <Input.TextArea
            style={{ marginTop: 10 }}
            placeholder="请输入原因"
            rows={4}
            onChange={(e) => setShyy(e.target.value)}
          />
        )}
      </Modal>

      <Modal title="类别选择" open={isShow} onCancel={() => setIsShow(false)} onOk={handleLbxzOk}>
        <TreeSide
          defaultData={isZt ? ztTreeData : treeData}
          multiple={false}
          setSelectedTreeData={setLbxz}
        />
      </Modal>
    </PageContainer>
  );
};

export default TableList;
